package basic;

public class Ex1 implements Runnable {
	private static int taskCount = 0;

	private final int id = taskCount++;

	public Ex1() {
		System.out.println("创建线程：" + id);
	}

	public void run() {
		System.out.println("开始执行：" + id);
		Thread.yield();
		System.out.println("执行完毕：" + id);
		return;
	}

	public static void main(String[] args) {
		for (int i = 0; i < 3; i++) {
			Thread t = new Thread(new Ex1());
			t.start();
		}

	}

}
